import Global from "../../../Global"
import cjs=createjs
import NumberWord from "./NumberWord"
//import createjs from "../../../../createjs"
export default class SignInDay extends cjs.Container{
    private day:cjs.MovieClip
    private digit_word:NumberWord
    private gold_coin:cjs.Bitmap
    private fragment:cjs.Bitmap
    constructor(){
        super()
        const lib=Global.getLibrary()
        this.day=new lib.SignInDay()
        this.addChild(this.day)
        //数字
        this.digit_word=new NumberWord()
        this.digit_word.setTransform(30,115,0.7,0.7)
        this.addChild(this.digit_word)
        //金币字
        this.gold_coin=new cjs.Bitmap(Global.loader.getResult('gold_coin_font'))
        const rect=this.digit_word.getBounds()
        this.gold_coin.setTransform(this.digit_word.x+rect.width*0.7-10,this.digit_word.y,0.6,0.6)
        this.addChild(this.gold_coin)
        //图片碎片
        this.fragment=new cjs.Bitmap(Global.loader.getResult('image_fragments'))
        this.fragment.setTransform(200,80)
        this.addChild(this.fragment)
    }
    setDayIndex(value:number):void{
        this.day.gotoAndStop(value)
        if(value==6){
            this.digit_word.visible=false
            this.gold_coin.visible=false
            this.fragment.visible=true
        }else{
            this.digit_word.visible=true
            this.gold_coin.visible=true
            this.fragment.visible=false
        }
    }
    setRewardCoin(value:number):void{
        this.digit_word.setValue(value)
        const rect=this.digit_word.getBounds()
        this.gold_coin.x=this.digit_word.x+rect.width*0.7
    }
}